#ifndef CONNECTION_H
#define CONNECTION_H

#include "../Socket/Socket.h"
#include "../Utils/ByteArray.h"
#include "../Messages/Message.h"

#include <queue>

class Socket;




class Connection
{
private:

	Socket*			m_socket;

	bool			m_isLogIn;
	std::string		m_id;
	std::string m_name;
	double m_health;
	double m_posX;
	double m_posY;
	int m_rotation;

	std::vector< Message* >	m_pendingMessages;

public:
	
	Connection(Socket* socket);
	~Connection();

	Socket* getSocket();

	// User info
	void setId(std::string id);
	std::string	getId();
	void setName(std::string name) {m_name = name;}
	std::string	getName() {return m_name;}
	void setHealth(double health) {m_health = health;}
	double getHealth() {return m_health;}
	void setPosX(double posX) {m_posX = posX;}
	double getPosX() {return m_posX;}
	void setPosY(double posY) {m_posY = posY;}
	double getPosY() {return m_posY;}
	void setRotation(int rotation) {m_rotation = rotation;}
	double getRotation() {return m_rotation;}

	void		addPendingMessage(Message *msg);
	void		sendFirstPendingMessage();
};

#endif // CONNECTION_H
